package com.example.myapplication;

import android.content.Context;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

public class myadapter extends ArrayAdapter {


    public myadapter(Context context, int resource, ArrayList<HashMap<String,String>> list){
        super(context,resource,list);
    }
    public View getView(int position, View convertView, ViewGroup parent){
        View itemView = convertView;
        if(itemView == null){
            itemView= LayoutInflater.from(getContext()).inflate(R.layout.list_item,parent,false);;
        }
        Map<String,String> map =(Map<String, String>) getItem(position);
        TextView title =itemView.findViewById(R.id.itemTitle);
        TextView detail = itemView.findViewById(R.id.itemDetail);

        title.setText("币种:"+map.get("ItemTitle"));
        detail.setText("汇率"+map.get("ItemDetail"));

        return itemView;
    }
}
